package com.changan.dao.impl;
import com.changan.pojo.SmbmsUser;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class UserDaoImplTest {

    @Test
    public void findUsers() {
        //测试sessionFactory能否使用
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SessionFactory factory =(SessionFactory)context.getBean("sessionFactory");
        Query query = factory.openSession().createQuery("from SmbmsUser");
        List<SmbmsUser> list = query.list();
        System.out.println(list.size());
    }
}